package com.emex.app.web.service;

import com.emex.app.shared.data.Provider;
import com.emex.app.shared.data.ProviderExample;
import com.emex.app.shared.persistance.ProviderMapper;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 *
 * @author Sergey Karavaev
 */
@Service
@Transactional
public class ProviderService {

    @Autowired
    private ProviderMapper providerMapper;

    public int deleteProviderByPrimaryKey(Integer id) {
        return providerMapper.deleteByPrimaryKey(id);
    }

    public Provider insertProvider(Provider record) {
        providerMapper.insert(record);
        return record;
    }

    public List<Provider> selectProviderByExample(ProviderExample example) {
        return providerMapper.selectByExample(example);
    }

    public List<Provider> getAllProviders() {
        return selectProviderByExample(null);
    }

    public Provider updateProvider(Provider record) {
        providerMapper.updateByPrimaryKey(record);
        return record;
    }

    public Provider selectProviderByPrimaryKey(Integer id) {
        return providerMapper.selectByPrimaryKey(id);
    }
}
